{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Movie Database</title>
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="{% static 'movies/css/style.css' %}">
</head>
<body>
    <div class="container">
        <!-- 热播电影部分 -->
        <div class="movie-section">
            <div class="section-header">
                <h2>热播电影</h2>
                <button class="next-btn" onclick="nextPage('trending')">显示更多 ❯</button>
            </div>
            <div class="movie-grid" id="trending-grid">
                {% for movie in trending_movies %}
                <div class="movie-card">
                    <img src="{{ movie.poster.url }}" alt="{{ movie.title }}" class="movie-poster">
                    <div class="movie-info">
                        <h3>{{ movie.title }}</h3>
                        <p class="movie-description">{{ movie.description|truncatechars:60 }}</p>
                        <div class="movie-meta">
                            <span class="rating">⭐ {{ movie.rating }}</span>
                            <span class="year">{{ movie.release_year }}</span>
                        </div>
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>

        <!-- 最新上映部分 -->
        <div class="movie-section">
            <div class="section-header">
                <h2>最新上映</h2>
                <button class="next-btn" onclick="nextPage('latest')">显示更多 ❯</button>
            </div>
            <div class="movie-grid" id="latest-grid">
                {% for movie in latest_movies %}
                <div class="movie-card">
                    <img src="{{ movie.poster.url }}" alt="{{ movie.title }}" class="movie-poster">
                    <div class="movie-info">
                        <h3>{{ movie.title }}</h3>
                        <p class="movie-description">{{ movie.description|truncatechars:60 }}</p>
                        <div class="movie-meta">
                            <span class="rating">⭐ {{ movie.rating }}</span>
                            <span class="year">{{ movie.release_year }}</span>
                        </div>
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>
    </div>

    <script src="{% static 'movies/js/script.js' %}"></script>
</body>
</html>
